package com.hh.mall.common.exception;

/**
 * Exception 拦截
 */
public enum ExceptionCodeEnum implements ExceptionHandler{
    // 数据操作错误定义
    SUCCESS(200, "操作成功"),
    FAILED(500, "操作失败"),
    PRAM_NOT_MATCH(400, "参数不正确"),
    VALIDATE_FAILED(400, "参数检验失败"),
    UNAUTHORIZED(401, "未登录或令牌失效，请登录！"),
    UNREGISTERED(4001, "请先注册！"),
    FORBIDDEN(403, "没有相关权限"),
    NOT_FOUND(404, "没有找到相关数据"),
    SIGNATUREFAILED(405, "签名错误"),
    SIGNATURENOTNULL(406, "签名不能为空"),
    TIMESTAMPSTRNOTNULL(407, "时间戳不能为空"),
    TIMESTAMPSTROVERTIME(408, "请求超时"),
    ERROR(500, "系统异常"),
    ;

    private long code;
    private String message;

    private ExceptionCodeEnum(long code, String message) {
        this.code = code;
        this.message = message;
    }

    @Override
    public long getCode() {
        return this.code;
    }

    @Override
    public String getMessage() {
        return this.message;
    }
}
